<?php

	class ParentMonster{
		public $monsterName;
		public $lifeNum;
		public $attackNum;
		
		public function __construct($name,$lnum,$anum){
			$this->setMonsterName($name);
			$this->setLifeNum($lnum);
			$this->setAttackNum($anum);
		}
		
		public function setMonsterName($name){
			$this->monsterName=$name;
		}
		public function getMonsterName(){
			return $this->monsterName;
		}
		
		public function setLifeNum($lnum){
			$this->lifeNum=$lnum;
		}
		public function getLifeNum(){
			return $this->lifeNum;
		}
		
		public function setAttackNum($anum){
			$this->attackNum=$anum;
		}
		public function getAttackNum(){
			return $this->attackNum;
		}
	}

	class Snake extends ParentMonster{
		public $boolnum;
		public $skill;
		
		public function __construct($name,$lnum,$anum,$boolnum,$skill){
			ParentMonster::__construct($name,$lnum,$anum);
			$this->setBoolnum($boolnum);
			$this->setSkill($skill);
		}
		
		public function setBoolnum($boolnum){
			$this->boolnum=$boolnum;
			if($boolnum<10){
				$boolnum=$boolnum+20;
			}
		}
		public function setSkill($skill){
			$this->skill=$skill;
		}
		
		public function runing(){
			echo "怪物蛇妖甲展开攻击";
			echo "<br>";
			echo "当前生命值是：".$this->getLifeNum();
			echo "<br>";
			echo "攻击力是：".$this->getAttackNum();
			echo "<br>";
			echo "实施大蛇补血术。。。。。。当前生命值是：".$this->boolnum;
			echo "<br>";
			echo "我是".$this->getMonsterName()."我走".$this->skill;
			echo "<hr>";
		}
	}
	
	class Centipede extends ParentMonster{
		
		public $skill;
		
		public function __construct($name,$lnum,$anum,$skill){
			ParentMonster::__construct($name,$lnum,$anum);
			$this->setSkill($skill);
		}
		
		public function setSkill($skill){
			$this->skill=$skill;
		}
		
		public function playing(){
			echo "怪物蜈蚣乙展开攻击";
			echo "<br>";
			echo "当前生命值是：".$this->getLifeNum();
			echo "<br>";
			echo "攻击力是：".$this->getAttackNum();
			echo "<br>";
			echo "我是".$this->getMonsterName().$this->skill;
		}
	}
	
	$s=new Snake('蛇怪','5','20','25','S型路线');
	$s->runing();
	
	$c=new Centipede('蜈蚣','60','15','御风飞行');
	$c->playing();
?>